﻿@model SummaryModel
@using Logistics.Web.Models.Order
@{
    ViewBag.Title = "Order Confirmation";

    Layout = "~/Views/Shared/_Layout";
}


<h3>Order Confirmation</h3>
<div class="col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
    <p>Thank you for choosing SpotsHUB. We are looking forward to serving you again.</p>
</div>
@foreach (var location in Model.Locations)
{
    <div class="col-ms-12 col-xs-12 col-sm-6 col-md-8 col-lg-8">
        <div class="window confirm-order">
            <div class="window-title grad-lightgrey grad">
                <div class="window-title-bar grad-titleshine grad">
                    <h2>Addresses</h2>
                </div>
            </div>
            <div class="window-content space">
                <div class="detail-locations col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
                    <div class=" window-content">
                        @if (location.IsUserAddressPickup)
                        {
                            <div class="detail-line"><h3>Pickup</h3></div>
                        }
                        else
                        {
                            <div class="detail-line"><h3>Delivery</h3></div>
                        }

                        <div class="detail-line">
                            <strong>
                                @Html.DisplayFor(model => location.UserAddress.Company)
                            </strong>
                        </div>
                        <div class="detail-line">
                            <strong>
                                @Html.DisplayFor(model => location.UserAddress.FirstName)
                                @Html.DisplayFor(model => location.UserAddress.LastName)
                            </strong>
                        </div>
                        <div class="detail-line">
                            <div>
                                @Html.DisplayFor(model => location.UserAddress.Address1)
                            </div>
                            <div>
                                @Html.DisplayFor(model => location.UserAddress.Address2)
                            </div>
                        </div>
                        <div class="detail-line">
                            @Html.DisplayFor(model => location.UserAddress.City),
                            @Html.DisplayFor(model => location.UserAddress.StateProvinceName),
                            @Html.DisplayFor(model => location.UserAddress.CountryName)
                        </div>
                        <div class="detail-line">
                            @if (location.UserAddress.CellPhoneNumber != null)
                            {
                                <div>
                                    Cell phone: @Html.DisplayFor(model => location.UserAddress.CellPhoneNumber)
                                </div>
                            }
                            @if (location.UserAddress.PhoneNumber != null)
                            {
                                <div>
                                    Secondary phone: @Html.DisplayFor(model => location.UserAddress.PhoneNumber)
                                </div>
                            }
                        </div>
                    </div>
                </div>
                <div class="detail-locations col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
                    <div class=" window-content">
                        @if (location.IsUserAddressPickup)
                        {
                            <div class="detail-line"><h3>Delivery</h3></div>
                        }
                        else
                        {
                            <div class="detail-line"><h3>Pickup</h3></div>
                        }

                        <div class="detail-line">
                            <strong>
                                @Html.DisplayFor(model => location.Address.Company)
                            </strong>
                        </div>
                        <div class="detail-line">
                            <strong>
                                @Html.DisplayFor(model => location.Address.FirstName)
                                @Html.DisplayFor(model => location.Address.LastName)
                            </strong>
                        </div>
                        <div class="detail-line">
                            <div>
                                @Html.DisplayFor(model => location.Address.Address1)
                            </div>
                            <div>
                                @Html.DisplayFor(model => location.Address.Address2)
                            </div>
                        </div>
                        <div class="detail-line">
                            @Html.DisplayFor(model => location.Address.City),
                            @Html.DisplayFor(model => location.Address.StateProvinceName),
                            @Html.DisplayFor(model => location.Address.CountryName)
                        </div>
                        <div class="detail-line">
                            @if (location.Address.CellPhoneNumber != null)
                            {
                                <div>
                                    Cell phone: @Html.DisplayFor(model => location.Address.CellPhoneNumber)
                                </div>
                            }
                            @if (location.Address.PhoneNumber != null)
                            {
                                <div>
                                    Secondary phone: @Html.DisplayFor(model => location.Address.PhoneNumber)
                                </div>
                            }
                        </div>
                    </div>
                </div>
                <div class="clear"></div>
            </div>

            <div class="clear"></div>
        </div>
    </div>
    <div class="col-ms-12 col-xs-12 col-sm-6 col-md-4 col-lg-4">
        <div class="window">
            <div class="window-title grad-lightgrey grad">
                <div class="window-title-bar grad-titleshine grad">
                    <h2>Packages</h2>
                </div>
            </div>
            <div class="window-content space">
                @foreach (var package in location.Packages)
                {
                    <div class="detail-package">
                        <h3>Package @package.Id: <strong>$@package.Charge</strong></h3>
                        <div>@package.Name</div>

                    </div>
                }
                <div class="detail-package-total">
                    <h3>Order Subtotal: $@Html.DisplayFor(model => location.SubTotalExcSurchageTax)</h3>
                </div>
            </div>
        </div>
    </div>
}
<div class="clear"></div>
<div class="payment-info-hr"></div>

<div class="col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
    <div class="window confirm-billing-address">
        <div class="window-title grad-lightgrey grad">
            <div class="window-title-bar grad-titleshine grad">
                <h2>Billing Address</h2>
            </div>
        </div>
        <div class="col-ms-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <div class="window-content">

                <div class="detail-line">
                    <strong>
                        @Html.DisplayFor(model => model.BillingAddress.Company)
                    </strong>
                </div>
                <div class="detail-line">
                    <strong>
                        @Html.DisplayFor(model => model.BillingAddress.FirstName)
                        @Html.DisplayFor(model => model.BillingAddress.LastName)
                    </strong>
                </div>
                <div class="detail-line">
                    <div>
                        @Html.DisplayFor(model => model.BillingAddress.Address1)
                    </div>
                    <div>
                        @Html.DisplayFor(model => model.BillingAddress.Address2)
                    </div>
                </div>
                <div class="detail-line">
                    @Html.DisplayFor(model => model.BillingAddress.City)
                    @Html.DisplayFor(model => model.BillingAddress.StateProvinceName)
                    @Html.DisplayFor(model => model.BillingAddress.ZipPostalCode)
                </div>
                <div class="detail-line">
                    @if (Model.BillingAddress.CellPhoneNumber != null)
                {
                    <div>
                        Cell phone: @Html.DisplayFor(model => model.BillingAddress.CellPhoneNumber)
                    </div>
                }
                    @if (Model.BillingAddress.PhoneNumber != null)
                {
                    <div>
                        Secondary phone: @Html.DisplayFor(model => model.BillingAddress.PhoneNumber)
                    </div>
                }
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
</div>
<div class="col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
    <div class="window">
        <div class="window-title grad-lightgrey grad">
            <div class="window-title-bar grad-titleshine grad">
                <h2>Total</h2>
            </div>
        </div>
        <div class="window-content space">
            <div class="orderconfirm-total">
                <table>
                    <tbody>
                        <tr><td class="confirm-item">Subtotal</td><td class="confirm-charge">$@Html.DisplayFor(model => model.SubTotalExcSurchargeTax)</td></tr>
                        <tr><td class="confirm-item">Surcharge @(Model.FuelSurchargeRate * 100)%</td><td class="confirm-charge">$@Html.DisplayFor(model => model.FuelSurcharge)</td></tr>
                        <tr><td class="confirm-item">Tax @(Model.TaxRate * 100)%</td><td class="confirm-charge">$@Html.DisplayFor(model => model.Tax)</td></tr>
                    </tbody>
                </table>
            </div>
            <div class="orderconfirm-total">
                <h3>Final Total: $@Html.DisplayFor(model => model.Total)</h3>
            </div>
            <div class="content-clear"></div>
        </div>
    </div>
</div>

<div class="clear"></div>


<div class="col-ms-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <div class="confirm-links">
        @Html.ActionLink("Print Shipping Label", "DownloadWaybill", "Order", null, new { @class = "button-red" })
    </div>
</div>
<div class="clear"></div>

<script type="text/javascript">
    $(document).ready(function () {
        $('.ajax-loading-wrapper').hide();
        $('.ajax-loading-box').addClass("label-notification");
        $('.ajax-loading-box .title').html('<h2><span class="red" style="text-transform: initial;">Spots</span>HUB</h2>');
        $('.ajax-loading-box .content').html('<h3><span class="red">IMPORTANT</span></h3><p>Please ensure that the shipping label is printed and clearly displayed on the package. If the pickup address differs from your account address, please ensure the shipper (at the pickup location) has received, printed and displayed the shipping label on the package before the arrival of the driver.</p><div class="ajax-notification-buttons one"><a class="ajax-notification-continue button-red">Okay</a></div>');
        $('#ajax-notification, .ajax-loading-box').fadeIn();
        $('.ajax-notification-continue').click(function () {
            $('.ajax-loading-box, #ajax-notification').fadeOut();
        });
    });

</script>